package com.googlecode.kipler.satisfiability.completion.rule.individual.uniformnotation;

import com.googlecode.kipler.syntax.concept.BooleanConcept;
import com.googlecode.kipler.syntax.concept.Concept;
import com.googlecode.kipler.syntax.concept.BooleanConcept.Constructor;

public class IntersectionAlphaConcept implements AlphaConcept {
	private BooleanConcept intersection;

	private Concept alpha1, alpha2;

	private boolean valid;

	public IntersectionAlphaConcept() {
		super();
	}

	public IntersectionAlphaConcept(Concept concept) {
		setAlpha(concept);
	}

	@Override
	public void setAlpha(Concept concept) {
		valid = false;
		if (concept instanceof BooleanConcept) {
			intersection = (BooleanConcept) concept;
			if (intersection.getConstructor() == Constructor.INTERSECTION) {
				alpha1 = intersection.getLhs();
				alpha2 = intersection.getRhs();
				valid = true;
			}
		}
	}

	@Override
	public Concept getAlpha1() {
		return alpha1;
	}

	@Override
	public Concept getAlpha2() {
		return alpha2;
	}

	public boolean isValid() {
		return valid;
	}

}
